package king.dominic.jlibrary.util;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import java.util.List;

/**
 * Created by Administrator on 2017/10/13.
 * PackageUtils
 */

public class PackageUtils {
    private PackageUtils(){}
    public  static boolean isAppAvailable(Context context, String packageName){
        final PackageManager p=context.getPackageManager();
        List<PackageInfo>  info=p.getInstalledPackages(0);
        for(PackageInfo i:info){
            if(i.packageName.equals(packageName))return true;
        }
        return false;
    }
}
